package com.wqm.step.dao.impl;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

import com.wqm.step.dao.OneToOneDao;
import com.wqm.step.pojo.IDCard;
import com.wqm.step.pojo.User;

@Repository
public class OneToOneDaoImpl extends HibernateDaoSupport implements OneToOneDao {

	@Autowired
	public void setSuperSessionFactory(SessionFactory factory) {
		super.setSessionFactory(factory);
	}
	
	public void saveOneToOne(User user, IDCard idcard) {
		Session session = this.getSessionFactory().getCurrentSession();
		// 3.身份证号关联人
		idcard.setUser(user);
		// 4.存储身份证号
		session.save(idcard);
	}

}
